package huawei.ran;

public class J1103 {
    public int[] distributeCandies(int candies, int num_people) {
        int[] res = new int[num_people];
        int cur =1;
        int index =0;
        while (candies>0){
            int tmp=Math.min(cur,candies);
            candies-=tmp;
            res[index]+=tmp;
            index=(index+1)%num_people;
            cur++;
        }
        return res;
    }
}
